<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%
    request.setCharacterEncoding("UTF-8");
    String htmlData = request.getParameter("content1") != null ? request.getParameter("content1") : "";
%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ include file="/WEB-INF/JSP/backHome/modalWindows/StudentsListPage.jsp" %>
<%@ include file="/WEB-INF/JSP/backHome/modalWindows/argeeCommon.jsp" %>
<%@ include file="/WEB-INF/JSP/backHome/modalWindows/againstAuditCommon.jsp" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    <script type="text/javascript" src="<%=path%>/My97DatePicker/WdatePicker.js"></script>
    <link rel="stylesheet" type="text/css" href="<%=path%>/CSS/backLayout.css">
    <link rel="stylesheet" type="text/css" href="<%=path%>/CSS/bombBox.css">
</head>
<style>
    select {
        width: 234px;
        height: 31px
    }

    #table1 select {
        width: 184px;
        height: 31px
    }

    #table2 select {
        width: 184px;
        height: 31px
    }

    #table3 select {
        width: 184px;
        height: 31px
    }

    .gn_name {
        padding-top: 5px
    }

    .div_zilei {
        width: 94.5%;
        padding-left: 90px;
        height: 30px
    }

    .tr {
        height: 40px;

        font-weight: 700;
    }

    .tr td {
        font-size: 14px;
        background: #57a0ff;
        color: #ffffff;
    }

    .tr_td {
        height: 40px;
    }

    .tr_td td {
        border-bottom: 1px solid #ededed;
        text-align: center;
    }

    tr td:nth-child(1) {
        font-size: 14px;
        color: #ffffff;
    }

    .date {
        border: 0;
        background: #ffffff;
        text-align: center;
    }

    .tr_td td:nth-child(1) {
        border-left: 1px solid #cccccc;
    }

    .tr_td td:nth-child(3) {
        border-right: 1px solid #cccccc;
    }

    .addTable.deleteTable:HOVER {
        cursor: pointer;
    }

    type[type='checkbox'] {
        width: 15px
    }

    #table1 input {
        width: 180px
    }

    #table2 input {
        width: 180px;
    }

    .fseq2 {
        width: 25px;
        border: none;
        color: #cccccc;
        text-align: center;
    }

    .content_id {
        width: 800px;
       /* border: 2px solid #ccc;*/
        padding: 5px 50px 0 50px;
        font-size: 18px;
        display: none;
    }

    #head {
        text-align: center;
        line-height: 40px;
        font-size: 28px;
        font-weight: bold;
    }

    .content_id .text1 span {
        width: 32%;
        display: inline-block;
        line-height: 40px;
    }
    .content_id .text1 span:nth-child(2) {
        width: 20%;
        margin-left: 80px;
    }

    .content_id .text2 table tr td {
        border: 1px solid #999; /*细线表格线条颜色*/
        height: 40px;
        font-size: 18px;
        color: #0a0e0a;
    }

    .content_id .text2 table {
        width: 100%;
        border: 1px solid #000;
        border-collapse: collapse; /*细线表格代码*/
        text-align: center;
    }

    .content_id .text3 span {
        line-height: 40px;
        display: inline-block;
        font-weight: bold

    }

    .content_id .text3 span:nth-child(1) {
        width: 22%;
    }

    .content_id .text3 span:nth-child(2) {
        width: 24%;
    }

    .content_id .text3 span:nth-child(3) {
        width: 20%;
    }

    .content_id .text3 span:nth-child(4) {
        width: 26%;
    }

    .content_id .text4 span {
        line-height: 30px;
        font-size: 16px;
        font-weight: bold
    }

    .content_id .text5 {
        padding-top: 20px;
        height: 72px;
    }

    .content_id .text5 span {
        display: block;
        font-size: 16px;
    }

    .content_id .text5 span:nth-child(1) {
        width: 12%;
        float: left;
        font-weight: bold;
    }

    .content_id .text5 span:nth-child(2) {
        width: 88%;
        float: right;
    }

    .content_id .text6 {
        padding-top: 30px;
        height: 36px;
        font-size: 16px;
    }

    .content_id .text6 span {
        display: block;
    }

    .content_id .text6 span:nth-child(1) {
        width: 12%;
        float: left;
        font-weight: bold;
    }

    .content_id .text6 span:nth-child(2) {
        width: 88%;
        float: right;
    }

    .content_id .text7 {
        font-size: 16px;
        line-height: 50px;
    }
    .div_input_hang {
        width: 100%;
        height: 40px;
    }
    .input_hang {
        float: left;
        width: 500px;
        height: 40px;
    }
</style>
<body style="background: #f5f5f5">
<div class="main">
    <div id="modal-overlay">

    </div>
    <div class="modal-data">
        <div style="height: 60px">
            <ul>
                <li style="text-align: left;margin-left: 60px;height: 40px;line-height: 40px">
                    <span>名称：</span>
                    <span>
				  		 	<input class="name" type="text">
				  		</span>
                    <span>
				  			<button class="findBtn">
				  				查询
				  			</button>
				  		</span>
                </li>
            </ul>
        </div>
        <div style="width:auto; height:350px; overflow:scroll;">
            <form action="">
                <table class="head2" style="width: auto;white-space:nowrap;border-spacing: 0px">
                    <tr style="background: #f2f2f2;height: 30px;line-height: 20px;" class="sel">
                        <td style="width: 20px"></td>
                        <td>名称</td>
                        <td>编码</td>
                        <td>简称</td>
                        <td>描述</td>
                        <td>创建时间</td>
                        <td>用户名</td>
                        <td>最后修改时间</td>
                        <td>用户名</td>
                        <td>财务组织</td>
                    </tr>
                    <c:forEach items="${drivings}" var="drivings">
                        <tr style="margin-top: 45px" class="jx">
                            <td><input type="checkbox" name="jx" value="${drivings.fid}"></td>
                            <td>${drivings.fnameL2}</td>
                            <td>${drivings.fnumber}</td>
                            <td>${drivings.fsimplename}</td>
                            <td>${drivings.fdescriptionL2}</td>
                            <td>${drivings.fcreatetime}</td>
                            <td>${drivings.createName}</td>
                            <td>${drivings.flastupdatetime}</td>
                            <td>${drivings.updateName}</td>
                            <td>${drivings.companyName}</td>
                        </tr>
                    </c:forEach>
                </table>
            </form>
        </div>
        <button class="subtn" style="width: 200px;position: absolute;bottom: 25px;font-size: 16px;left: 170px">
            确定
        </button>
        <button class="btn" style="width: 200px;position: absolute;bottom: 25px;font-size: 16px;right: 170px">
            关闭
        </button>
    </div>
    <c:if test="${empty ownCarTrain}">
        <div class="weizhi">
            财务管理>>考前训练收费>>新增
        </div>
    </c:if>
    <c:if test="${not empty ownCarTrain}">
        <c:if test="${ownCarTrain.cfbillstate <= 3 }">
            <div class="weizhi">
                财务管理>>考前训练收费>>修改
            </div>
        </c:if>
    </c:if>
    <c:if test="${not empty ownCarTrain}">
        <c:if test="${ownCarTrain.cfbillstate > 3 }">
            <div class="weizhi">
                财务管理>>考前训练收费>>查看
            </div>
        </c:if>
    </c:if>
    <div class="div_body" style="box-shadow: 0 0 5px #cccccc;height: 1000px">

        <div class=content_id>
            <div id="head">考前训练收费单</div>
            <div class="text1">
                <span>姓名：<span style="font-size: 24px;">${ownCarTrainEntrys[0].cfchepai}</span></span>
                <span>通行证号：</span>
                <span>单号：${ownCarTrain.fnumber}</span>
            </div>
            <div class="text2">
                <table>
                    <tr>
                        <td>训练车型</td>
                        <td>次数</td>
                        <td>单价</td>
                        <td>金额</td>
                        <td>人数</td>
                        <td>备注</td>
                    </tr>
                    <tr>
                        <td>普桑（）伊兰特（）自动（）</td>
                        <td>${ownCarTrainEntrys[0].cfchexing}</td>
                        <td>${ownCarTrainEntrys[0].cfprice}</td>
                        <td>${ownCarTrainEntrys[0].cfprice * ownCarTrainEntrys[0].cfqty}</td>
                        <td>${ownCarTrainEntrys[0].cfqty}</td>
                        <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
                    </tr>
                </table>
            </div>
            <div class="text3">
                <span>金额合计：${ownCarTrainEntrys[0].cfprice * ownCarTrainEntrys[0].cfqty}元</span>
                <span>大写： <span style="width: 100%;display:inline" id="big_amount">${ownCarTrainEntrys[0].cfprice * ownCarTrainEntrys[0].cfqty}</span></span>
                <span>出纳：${ownCarTrain.createName}</span>
                <span>业务日期：${ownCarTrain.fbizdate}</span>
            </div>
            <div class="text4">
                <span>联系人：18007002685（高传勇）</span>
            </div>
            <div class="text5">
                <span>特别约定：</span>
                <span>教练员带领学员在考前训练过程中引发事故并造成自己、他人财产损失及人身损失及人身伤害的，由教练员及学员负责全部责任：此外，若训练场所有方因此涉及诉讼、仲裁等形式的纠纷，教练员及学员除承担全部责任外，还应当赔偿训练场所所有方因此支付的律师费、误工费、交通费等一切相关的经济损失。</span>
            </div>
            <div class="text6">
                <span>温馨提示：</span>
                <span>早晨6:00之前到考场，因个人原因迟到导致不能进行模拟训练的，驾校不予退费，学员自己承担。</span>
            </div>
            <br/>
            <div class="text7">
                <span>教练员同意上述约定签字：</span>
            </div>
        </div>
        <div class="div_form">
            <!----------------------------- 新增 --------------------------------->
            <c:if test="${empty ownCarTrain}">
                <form action="<%=path%>/DrivingSys/editOwnCarTrain" class="form" method="post"
                      onsubmit="return verify();">
                    <div class="div_input_hang">
                        <div class="input_hang">
                            <span class="gn_name">驾校&nbsp;:&nbsp;</span>
                            <input type="text" name="name" value="${department.fnameL2}" readonly="readonly"
                                   style="color: gray;"/>
                        </div>
                        <div class="input_hang">
                            <span class="gn_name">单据编号&nbsp;:&nbsp;</span>
                            <input type="text" name="fnumber" value="${fnumber}" style="color: gray;"
                                   readonly="readonly"/>
                        </div>
                        <div class="input_hang">
                            <span class="gn_name">业务日期&nbsp;:&nbsp;</span>
                            <input type="text" name="fbizdate" id="ywrq" value="${time}"
                                   onclick="WdatePicker({el:'ywrq',dateFmt:'yyyy-MM-dd'})"/>
                            <img onclick="WdatePicker({el:'ywrq',dateFmt:'yyyy-MM-dd'})"
                                 src="<%=path%>/image/date.jpg" align="absmiddle" style="padding-left: 15px">
                        </div>
                    </div>
                    <div class="div_input_hang">
                        <div class="input_hang">
                            <span class="gn_name">备注&nbsp;:&nbsp;</span>
                            <input name="fdescription"/>
                        </div>
                        <div class="input_hang">
                            <span class="gn_name">单据状态&nbsp;:&nbsp;</span>
                            <select name="cfbillstate" disabled="disabled">
                                <option style="color: gray;">新增</option>
                            </select>
                        </div>
                        <div class="input_hang">
                            <span class="gn_name">打印次数&nbsp;:&nbsp;</span>
                            <input name="cfdycs" value="0" style="color: gray;" readonly="readonly"/>
                        </div>
                    </div>

                        <%--<div class="div_input_hang">
                                <div class="input_hang">
                                    <span class="gn_name">收费类型&nbsp;:&nbsp;</span>
                                    <select name="chargetype">
                                        <option value="1">自带车训练</option>
                                        <option value="2">考前模拟</option>
                                        <option value="3">委培</option>
                                    </select>
                                </div>
                        </div>--%>

                    <div class="div_zilei">
                        <div style="width: 93%;text-align: right;">
                            <img src="<%=path%>/image/insert2323.jpg" class="addTable">
                            <span style="padding-right: 20px;color: #57a0ff;font-weight: 700;font-size: 14px" class="addTable">添加</span>
                            <img src="<%=path%>/image/delete212.png" class="deleteTable">
                            <span class="deleteTable" style="color: #57a0ff;font-weight: 700;font-size: 14px"
                                  class="deleteTable">删除</span>

                        </div>
                    </div>
                    <input type="hidden" class="stu">
                    <div style="min-height: 500px;width: 88%;padding-left: 90px;position: relative;">
                        <div style="overflow:scroll;height: 500px;width: 100%">
                            <table width="100%" align="center" id="table1" style="min-height:50px;border-spacing:0;">
                                <tr class="tr">
                                    <td width="20px"></td>
                                    <td width="30px"></td>
                                    <td align="center">姓名</td>
                                    <td align="center">次数</td>
                                    <td align="center">车牌号码</td>
                                    <td align="center">科目</td>
                                    <td align="center">车型</td>
                                    <td align="center">协议驾校</td>
                                    <td align="center">单价</td>
                                    <td align="center">金额</td>
                                    <td align="center">人数</td>
                                    <td align="center">摘要</td>
                                </tr>
                            </table>

                            <table align="center" id="table2"
                                   style="height:50px;overflow:scroll;border-spacing:0;display: none;margin-top: 100px;">
                                <tr>
                                    <td rowspan="2"><input type="text" readonly="readonly" value="合计" class="fseq"
                                                           style="width: 55px"></td>
                                    <td><input type="text" readonly="readonly"></td>
                                    <td><input type="text" readonly="readonly"></td>
                                    <td><input type="text" readonly="readonly"></td>
                                    <td><input type="text" readonly="readonly"></td>
                                    <td><input type="text" readonly="readonly"></td>
                                    <td><input type="text" readonly="readonly"></td>
                                    <td><input type="text" readonly="readonly"></td>
                                    <td><input type="text" readonly="readonly" value="0" id="je"></td>
                                    <td><input type="text" readonly="readonly" value="0" id="rs"></td>
                                    <td><input type="text" readonly="readonly"></td>
                                </tr>
                            </table>
                        </div>
                    </div>


                    <div class="div_input_hang" style="margin-top: 50px">
                        <div class="input_hang">
                            <span class="gn_name">审核人&nbsp;:&nbsp;</span>
                            <input name="fhandlerid" readonly="readonly" style="color: gray;" type="text"/>
                        </div>
                        <div class="input_hang">
                            <span class="gn_name">创建者&nbsp;:&nbsp;</span>
                            <input name="fcreatorid2" readonly="readonly" value="${name}" style="color: gray;"
                                   type="text"/>
                            <input name="fcreatorid" readonly="readonly" style="color: gray;" type="hidden"/>
                        </div>
                        <div class="input_hang">
                            <span class="gn_name">创建时间&nbsp;:&nbsp;</span>
                            <input name="fcreatetime" style="color: gray;" readonly="readonly" type="text"/>
                        </div>
                    </div>

                    <div class="div_tj" style="padding-top: 0px;margin-left: 140px;margin-top: 20px;">
                        <div>
                            <input class="input_submit bc" value="" type="submit" style="margin-top: 0px;margin-right: 30px;"/>
                        </div>
                        <div>
                            <input type="button" class="input_back fh" value="" onclick="back()" style="margin-top: 0px;"/>
                        </div>
                    </div>
                </form>
            </c:if>

            <!----------------------------- 修改 --------------------------------->
            <c:if test="${not empty ownCarTrain}">
                <c:if test="${ownCarTrain.cfbillstate <= 3 }">
                    <form action="<%=path%>/DrivingSys/editOwnCarTrain" class="form" method="post"
                          onsubmit="return verify();">
                        <div class="div_input_hang">
                            <div class="input_hang">
                                <span class="gn_name">驾校&nbsp;:&nbsp;</span>
                                <input type="text" name="name" value="${ownCarTrain.companyName}" readonly="readonly"
                                       style="color: gray;"/>
                            </div>
                            <div class="input_hang">
                                <span class="gn_name">单据编号&nbsp;:&nbsp;</span>
                                <input type="text" name="fnumber" value="${ownCarTrain.fnumber}" style="color: gray;"
                                       readonly="readonly"/>
                            </div>
                            <div class="input_hang">
                                <span class="gn_name">业务日期&nbsp;:&nbsp;</span>
                                <input type="text" name="fbizdate" id="ywrq" value="${ownCarTrain.fbizdate}"
                                       onclick="WdatePicker({el:'ywrq',dateFmt:'yyyy-MM-dd'})"/>
                                <img onclick="WdatePicker({el:'ywrq',dateFmt:'yyyy-MM-dd'})"
                                     src="<%=path%>/image/date.jpg" align="absmiddle" style="padding-left: 15px">
                            </div>
                        </div>
                        <div class="div_input_hang">
                            <div class="input_hang">
                                <span class="gn_name">备注&nbsp;:&nbsp;</span>
                                <input name="fdescription" value="${ownCarTrain.fdescription}"/>
                                <input type="hidden" name="fid" value="${ownCarTrain.fid}" id="fid">
                            </div>
                            <div class="input_hang">
                                <span class="gn_name">单据状态&nbsp;:&nbsp;</span>
                                <select name="cfbillstate" disabled="disabled">
                                    <option style="color: gray;">保存</option>
                                </select>
                            </div>
                            <div class="input_hang">
                                <span class="gn_name">打印次数&nbsp;:&nbsp;</span>
                                <input name="cfdycs" style="color: gray;" readonly="readonly"
                                       value="${ownCarTrain.cfdycs}"/>
                            </div>
                        </div>

                            <%--<div class="div_input_hang">
                                    <div class="input_hang">
                                        <span class="gn_name">收费类型&nbsp;:&nbsp;</span>
                                        <select name="chargetype">
                                        <c:if test="${empty ownCarTrain.chargetype}">
                                            <option value="">请选择收费类型</option>
                                            <option value="1">自带车训练</option>
                                            <option value="2">考前模拟</option>
                                            <option value="3">委培</option>
                                        </c:if>
                                        <c:if test="${ownCarTrain.chargetype == '1'}">
                                            <option value="1" selected="selected">自带车训练</option>
                                            <option value="2">考前模拟</option>
                                            <option value="3">委培</option>
                                        </c:if>
                                        <c:if test="${ownCarTrain.chargetype == '2'}">
                                            <option value="1">自带车训练</option>
                                            <option value="2" selected="selected">考前模拟</option>
                                            <option value="3">委培</option>
                                        </c:if>
                                        <c:if test="${ownCarTrain.chargetype == '3'}">
                                            <option value="1">自带车训练</option>
                                            <option value="2">考前模拟</option>
                                            <option value="3" selected="selected">委培</option>
                                        </c:if>
                                        </select>
                                    </div>
                            </div>--%>

                        <div class="div_zilei">
                            <div style="width: 93%;text-align: right;">
                                <img src="<%=path%>/image/insert2323.jpg" class="addTable">
                                <span style="padding-right: 20px;color: #a9bbe0;font-size: 14px"
                                      class="addTable">添加</span>
                                <img src="<%=path%>/image/delete212.png" class="deleteTable">
                                <span class="deleteTable" style="color: #57a0ff;font-weight: 700;font-size: 14px"
                                      class="deleteTable">删除</span>
                                <span style="margin-left: 20px; cursor:pointer; color: #57a0ff;font-weight: 700;font-size: 14px"
                                      class="printTable" onclick="print_func()">打印</span>
                            </div>
                        </div>
                        <input type="hidden" class="stu">
                        <div style="min-height: 500px;width: 88%;padding-left: 90px;position: relative;">
                            <div style="overflow:scroll;height: 500px;width: 100%">
                                <table width="100%" align="center" id="table1"
                                       style="min-height:50px;border-spacing:0;">
                                    <tr class="tr">
                                        <td width="20px"></td>
                                        <td width="30px"></td>
                                        <td align="center">姓名</td>
                                        <td align="center">次数</td>
                                        <td align="center">车牌号码</td>
                                        <td align="center">科目</td>
                                        <td align="center">车型</td>
                                        <td align="center">协议驾校</td>
                                        <td align="center">单价</td>
                                        <td align="center">金额</td>
                                        <td align="center">人数</td>
                                        <td align="center">摘要</td>
                                    </tr>
                                    <c:forEach items="${ownCarTrainEntrys}" var="s">
                                        <tr style="margin-top: 45px" class="jx${s.fseq}">
                                            <td width="20px"><input type="checkbox" name="check" style="width: 15px">
                                            </td>
                                            <td>
                                                <input type="text" readonly="readonly" class="fseq2" value="${s.fseq}"
                                                       style="width: 40px">
                                                <input type="hidden" name="fseq" class="fseq" value="${s.fseq}">
                                            </td>
                                            <td><input type="text" name="cfchepai" class="cfchepai"
                                                       value="${s.cfchepai}"></td>
                                            <td><input type="text" name="cfchexing" class="cfchexing"
                                                       value="${s.cfchexing}" onblur="cfchexing2($(this))"></td>

                                            <td><input type="text" name="cfcarnumber" class="cfcarnumber"
                                                       value="${s.cfcarnumber}"></td>
                                            <td>
                                                <select name="cfkemu">
                                                    <c:if test="${empty s.cfkemu}">
                                                        <option value="">请选择</option>
                                                        <option value="1">科目一</option>
                                                        <option value="2">科目二</option>
                                                        <option value="3">科目三</option>
                                                    </c:if>
                                                    <c:if test="${s.cfkemu == '1'}">
                                                        <option value="1" selected="selected">科目一</option>
                                                        <option value="2">科目二</option>
                                                        <option value="3">科目三</option>
                                                    </c:if>
                                                    <c:if test="${s.cfkemu == '2'}">
                                                        <option value="1">科目一</option>
                                                        <option value="2" selected="selected">科目二</option>
                                                        <option value="3">科目三</option>
                                                    </c:if>
                                                    <c:if test="${s.cfkemu == '3'}">
                                                        <option value="1">科目一</option>
                                                        <option value="2">科目二</option>
                                                        <option value="3" selected="selected">科目三</option>
                                                    </c:if>
                                                </select>
                                            </td>
                                            <td>
                                                <select name="cfcartype">
                                                    <c:forEach items="${carTypes}" var="c">
                                                        <c:choose>
                                                            <c:when test="${s.cfcartype eq c}">
                                                                <option value="${c}" selected="selected">${c}</option>
                                                            </c:when>
                                                            <c:otherwise>
                                                                <option value="${c}">${c}</option>
                                                            </c:otherwise>
                                                        </c:choose>
                                                    </c:forEach>
                                                </select>
                                            </td>
                                            <td>
                                                <input type="text" name="drivingName" class="drivingName is_click_ne"
                                                       onclick="kq($(this))" value="${s.drivingName}">
                                                <input type="hidden" name="cfxyjsid" value="${s.cfxyjsid}">
                                            </td>
                                            <td><input type="text" name="cfprice" class="cfprice" value="${s.cfprice}"
                                                       onblur="cfprice2($(this))"></td>
                                            <td><input type="text" name="cfamount" class="cfamount"
                                                       onblur="cfamount2($(this))" value="${s.cfamount}"></td>
                                            <td><input type="text" name="cfqty" class="cfqty" onblur="cfqty2($(this))"
                                                       value="${s.cfqty}"></td>
                                            <td><input type="text" name="cfdesc" class="cfdesc" value="${s.cfdesc}">
                                            </td>
                                        </tr>
                                    </c:forEach>
                                </table>

                                <table align="center" id="table2"
                                       style="height:50px;overflow:scroll;border-spacing:0;margin-top: 100px;">
                                    <tr>
                                        <td rowspan="2"><input type="text" readonly="readonly" value="合计" class="fseq"
                                                               style="width: 55px"></td>
                                        <td><input type="text" readonly="readonly"></td>
                                        <td><input type="text" readonly="readonly"></td>
                                        <td><input type="text" readonly="readonly"></td>
                                        <td><input type="text" readonly="readonly"></td>
                                        <td><input type="text" readonly="readonly"></td>
                                        <td><input type="text" readonly="readonly"></td>
                                        <td><input type="text" readonly="readonly"></td>
                                        <td><input type="text" readonly="readonly" value="0" id="je"></td>
                                        <td><input type="text" readonly="readonly" value="0" id="rs"></td>
                                        <td><input type="text" readonly="readonly"></td>
                                    </tr>
                                </table>
                            </div>
                        </div>


                        <div class="div_input_hang" style="margin-top: 50px">
                            <div class="input_hang">
                                <span class="gn_name">审核人&nbsp;:&nbsp;</span>
                                <input name="fhandlerid" readonly="readonly" style="color: gray;" type="text"
                                       value="${ownCarTrain.auditName}"/>
                            </div>
                            <div class="input_hang">
                                <span class="gn_name">创建者&nbsp;:&nbsp;</span>
                                <input name="fcreatorid2" readonly="readonly" value="${ownCarTrain.createName}"
                                       style="color: gray;" type="text"/>
                            </div>
                            <div class="input_hang">
                                <span class="gn_name">创建时间&nbsp;:&nbsp;</span>
                                <input name="fcreatetime" style="color: gray;" readonly="readonly" type="text"
                                       value="${ownCarTrain.fcreatetime}"/>
                            </div>
                        </div>
                        <input type="hidden" id="auditState" value="${AuditState}">
                        <div class="div_tj" style="padding-top: 0px">
                            <shiro:hasPermission name="/queryownCarTrainByFid">
                                <div>
                                    <input class="input_submit bc" value="" type="submit">
                                </div>
                            </shiro:hasPermission>
                            <shiro:hasPermission name="/submitOwnCarTrain">
                                <div style="padding-right: 50px">
                                    <input type="button" class="input_submit tj" value="" id="submit">
                                </div>
                            </shiro:hasPermission>
                            <div>
                                <input type="button" class="input_back fh" value="" onclick="back()"/>
                            </div>
                        </div>
                    </form>
                </c:if>
            </c:if>


            <!----------------------------- 查看 --------------------------------->
            <c:if test="${not empty ownCarTrain}">
                <c:if test="${ownCarTrain.cfbillstate > 3 }">
                    <form action="<%=path%>/DrivingSys/editOwnCarTrain" class="form">
                        <div class="div_input_hang">
                            <div class="input_hang">
                                <span class="gn_name">驾校&nbsp;:&nbsp;</span>
                                <input type="text" name="name" value="${ownCarTrain.companyName}" readonly="readonly"
                                       style="color: gray;"/>
                            </div>
                            <div class="input_hang">
                                <span class="gn_name">单据编号&nbsp;:&nbsp;</span>
                                <input type="text" name="fnumber" id="fnumber" value="${ownCarTrain.fnumber}"
                                       style="color: gray;" readonly="readonly"/>
                            </div>
                            <div class="input_hang">
                                <span class="gn_name">业务日期&nbsp;:&nbsp;</span>
                                <input type="text" name="fbizdate" id="ywrq" value="${ownCarTrain.fbizdate}"
                                       readonly="readonly"/>
                                <img src="<%=path%>/image/date.jpg" style="padding-left: 15px">
                            </div>
                        </div>
                        <div class="div_input_hang">
                            <div class="input_hang">
                                <span class="gn_name">备注&nbsp;:&nbsp;</span>
                                <input name="fdescription" value="${ownCarTrain.fdescription}" readonly="readonly"/>
                                <input type="hidden" name="fid" value="${ownCarTrain.fid}" id="fid">
                            </div>
                            <div class="input_hang">
                                <span class="gn_name">单据状态&nbsp;:&nbsp;</span>
                                <select name="cfbillstate" disabled="disabled">
                                    <c:if test="${ownCarTrain.cfbillstate == 4}">
                                        <option style="color: gray;">提交</option>
                                    </c:if>
                                    <c:if test="${ownCarTrain.cfbillstate == 5}">
                                        <option style="color: gray;">审核</option>
                                    </c:if>
                                </select>
                            </div>
                            <div class="input_hang">
                                <span class="gn_name">打印次数&nbsp;:&nbsp;</span>
                                <input name="cfdycs" style="color: gray;" readonly="readonly"
                                       value="${ownCarTrain.cfdycs}"/>
                            </div>
                        </div>

                        <div class="div_input_hang">
                            <div class="input_hang">
                                <span class="gn_name">收费类型&nbsp;:&nbsp;</span>
                                <select name="chargetype" disabled="disabled">
                                    <c:if test="${ownCarTrain.chargetype == null}">
                                        <option value="">请选择收费类型</option>
                                        <option value="1">自带车训练</option>
                                        <option value="2">考前模拟</option>
                                        <option value="3">委培</option>
                                    </c:if>
                                    <c:if test="${ownCarTrain.chargetype == '1'}">
                                        <option value="1" selected="selected">自带车训练</option>
                                        <option value="2">考前模拟</option>
                                        <option value="3">委培</option>
                                    </c:if>
                                    <c:if test="${ownCarTrain.chargetype == '2'}">
                                        <option value="1">自带车训练</option>
                                        <option value="2" selected="selected">考前模拟</option>
                                        <option value="3">委培</option>
                                    </c:if>
                                    <c:if test="${ownCarTrain.chargetype == '3'}">
                                        <option value="1">自带车训练</option>
                                        <option value="2">考前模拟</option>
                                        <option value="3" selected="selected">委培</option>
                                    </c:if>
                                </select>
                            </div>
                        </div>

                        <div class="div_zilei">
                            <div style="width: 88%;text-align: right;">
                                    <%--<img src="<%=path%>/image/insert2323.jpg">
                                    <span style="padding-right: 20px;color: #a9bbe0;font-size: 14px">添加</span>
                                    <img src="<%=path%>/image/delete212.png" class="deleteTable">
                                    <span style="color: #a9bbe0;font-size: 14px">删除</span>--%>
                                        <span style="margin-left: 20px; cursor:pointer; color: #57a0ff;font-weight: 700;font-size: 14px"
                                              class="printTable" onclick="print_func()">打印</span>
                            </div>
                        </div>
                        <input type="hidden" class="stu">
                        <input type="hidden" id="state" value="${ownCarTrain.cfbillstate}">
                        <input type="hidden" id="type">
                        <div style="min-height: 500px;width: 88%;padding-left: 90px;position: relative;">
                            <div style="overflow:scroll;height: 500px;width: 100%">
                                <table width="100%" align="center" id="table1"
                                       style="min-height:50px;border-spacing:0;">
                                    <tr class="tr">
                                        <td width="20px"></td>
                                        <td width="30px"></td>
                                        <td align="center">姓名</td>
                                        <td align="center">次数</td>
                                        <td align="center">车牌号码</td>
                                        <td align="center">科目</td>
                                        <td align="center">车型</td>
                                        <td align="center">协议驾校</td>
                                        <td align="center">单价</td>
                                        <td align="center">金额</td>
                                        <td align="center">人数</td>
                                        <td align="center">摘要</td>
                                    </tr>
                                    <c:forEach items="${ownCarTrainEntrys}" var="s">
                                        <tr style="margin-top: 45px" class="jx${s.fseq}">
                                            <td width="20px"><input type="checkbox" name="check" style="width: 15px"
                                                                    disabled="disabled"></td>
                                            <td>
                                                <input type="text" readonly="readonly" class="fseq2" value="${s.fseq}"
                                                       readonly="readonly" style="width: 40px">
                                                <input type="hidden" name="fseq" class="fseq" value="${s.fseq}">
                                            </td>
                                            <td><input type="text" name="cfchepai" class="cfchepai"
                                                       value="${s.cfchepai}" readonly="readonly"></td>
                                            <td><input type="text" name="cfchexing" class="cfchexing"
                                                       value="${s.cfchexing}" readonly="readonly"></td>
                                            <td><input type="text" name="cfcarnumber" class="cfcarnumber"
                                                       value="${s.cfcarnumber}" readonly="readonly"></td>
                                            <td>
                                                <select name="cfkemu" disabled="disabled">
                                                    <c:if test="${empty s.cfkemu}">
                                                        <option value="">请选择</option>
                                                        <option value="1">科目一</option>
                                                        <option value="2">科目二</option>
                                                        <option value="3">科目三</option>
                                                    </c:if>
                                                    <c:if test="${s.cfkemu == '1'}">
                                                        <option value="1" selected="selected">科目一</option>
                                                        <option value="2">科目二</option>
                                                        <option value="3">科目三</option>
                                                    </c:if>
                                                    <c:if test="${s.cfkemu == '2'}">
                                                        <option value="1">科目一</option>
                                                        <option value="2" selected="selected">科目二</option>
                                                        <option value="3">科目三</option>
                                                    </c:if>
                                                    <c:if test="${s.cfkemu == '3'}">
                                                        <option value="1">科目一</option>
                                                        <option value="2">科目二</option>
                                                        <option value="3" selected="selected">科目三</option>
                                                    </c:if>
                                                </select>
                                            </td>
                                            <td>
                                                <select name="cfcartype" disabled="disabled">
                                                    <option value="${s.cfcartype}">${s.cfcartype}</option>
                                                    <option value="A1">A1</option>
                                                    <option value="A2">A2</option>
                                                    <option value="A3">A3</option>
                                                    <option value="B1">B1</option>
                                                    <option value="B2">B2</option>
                                                    <option value="C1">C1</option>
                                                    <option value="C2">C2</option>
                                                    <option value="C3">C3</option>
                                                    <option value="C4">C4</option>
                                                    <option value="D">D</option>
                                                    <option value="E">E</option>
                                                    <option value="F">F</option>
                                                    <option value="M">M</option>
                                                    <option value="N">N</option>
                                                </select>
                                            </td>
                                            <td>
                                                <input type="text" name="drivingName" class="drivingName"
                                                       readonly="readonly" value="${s.drivingName}">
                                                <input type="hidden" name="cfxyjsid" value="${s.cfxyjsid}">
                                            </td>
                                            <td><input type="text" name="cfprice" class="cfprice" value="${s.cfprice}"
                                                       readonly="readonly"></td>
                                            <td><input type="text" name="cfamount" class="cfamount" readonly="readonly"
                                                       value="${s.cfamount}"></td>
                                            <td><input type="text" name="cfqty" class="cfqty" readonly="readonly"
                                                       value="${s.cfqty}"></td>
                                            <td><input type="text" name="cfdesc" class="cfdesc" value="${s.cfdesc}"
                                                       readonly="readonly"></td>
                                        </tr>
                                    </c:forEach>
                                </table>

                                <table align="center" id="table2"
                                       style="height:50px;overflow:scroll;border-spacing:0;margin-top: 100px;">
                                    <tr>
                                        <td rowspan="2"><input type="text" readonly="readonly" value="合计" class="fseq"
                                                               style="width: 50px"></td>
                                        <td><input type="text" readonly="readonly"></td>
                                        <td><input type="text" readonly="readonly"></td>
                                        <td><input type="text" readonly="readonly"></td>
                                        <td><input type="text" readonly="readonly"></td>
                                        <td><input type="text" readonly="readonly"></td>
                                        <td><input type="text" readonly="readonly"></td>
                                        <td><input type="text" readonly="readonly"></td>
                                        <td><input type="text" readonly="readonly" value="0" id="je"></td>
                                        <td><input type="text" readonly="readonly" value="0" id="rs"></td>
                                        <td><input type="text" readonly="readonly"></td>
                                    </tr>
                                </table>
                            </div>
                        </div>


                        <div class="div_input_hang" style="margin-top: 50px">
                            <div class="input_hang">
                                <span class="gn_name">审核人&nbsp;:&nbsp;</span>
                                <input name="fhandlerid" readonly="readonly" style="color: gray;" type="text"
                                       value="${ownCarTrain.auditName}"/>
                            </div>
                            <div class="input_hang">
                                <span class="gn_name">创建者&nbsp;:&nbsp;</span>
                                <input name="fcreatorid2" readonly="readonly" value="${ownCarTrain.createName}"
                                       style="color: gray;" type="text"/>
                            </div>
                            <div class="input_hang">
                                <span class="gn_name">创建时间&nbsp;:&nbsp;</span>
                                <input name="fcreatetime" style="color: gray;" readonly="readonly" type="text"
                                       value="${ownCarTrain.fcreatetime}"/>
                            </div>
                        </div>
                        <div class="div_tj">
                            <c:if test="${AuditState == 'true'}">
                                <shiro:hasPermission name="/auditOwnCarTrain">
                                    <div style="padding-right: 50px">
                                        <input type="button" class="input_submit sh" value="" id="sh">
                                        <input type="hidden" value="1">
                                    </div>
                                </shiro:hasPermission>
                            </c:if>
                            <shiro:hasPermission name="/againstAuditOwnCarTrain">
                                <div style="padding-right: 50px">
                                    <input type="button" class="input_submit fsh" value="" id="fsh">
                                    <input type="hidden" value="2">
                                </div>
                            </shiro:hasPermission>
                            <div>
                                <input type="button" class="input_submit cklc" value=""
                                       onclick="lookActivitiImg('${key}',$('#fnumber').val())"/>
                            </div>
                            <div>
                                <input type="button" class="input_back fh" value="" onclick="back()"/>
                            </div>
                        </div>
                    </form>
                </c:if>
            </c:if>
        </div>
    </div>
</div>
</body>
<script type="text/javascript" src="<%=path%>/JQuery/jquery-1.8.2.js"></script>
<script type="text/javascript" src="<%=path%>/common/print/jQuery.print.min.js"></script>
<%@ include file="/WEB-INF/JSP/ajax.jsp" %>
<script type="text/javascript" src="<%=path%>/HoganJS/handlebars-v4.0.11.js"></script>
<script type="text/javascript">

    $(document).ready(function () {
        var type = "${type}"
        if (type == null || type == '') {

        } else {
            editAlert();
        }
    })

    //删除一行
    $(".deleteTable").click(function () {
        var tr_len = $("#table1 tr").length;
        if (tr_len == 1) {

        } else {
            var s = '';
            $('input:checkbox[name=check]').each(function (i) {
                if ($(this).is(':checked')) {
                    $(this).parent().parent().remove();
                    if (tr_len == 2) {
                        $("#table2").css('display', 'none')
                    }
                    s = '1';
                }
            })

            if ($("#table1 tr").length == 1) {
                $("#table2").css('display', 'none')
            }
            //计算金额
            jsje();
            //计算人数
            jsrs();
            //判断是否选中
            if (s == null || s == '') {
                alert("请选择一条数据删除");
                return false;
            }
            //重新排序
            $('#table1 tr td .fseq').each(function (i) {
                var s = i * 1 + 1 * 1;
                $(this).val(s);
                $(this).prev().val(s)
                $(this).parent().parent().attr("class", 'xy' + s);
            })
        }
    })

    //返回
    function back() {
        parent.closeSelectCard()

       // location = '<%=path%>/DrivingSys/queryOwnCarTrain/look.action';
    }

    //开启弹框
    function kq(_this) {
        var jx = _this.parent().parent().prop("class");
        $(".stu").val(jx)
        $('#modal-overlay').css('visibility', 'visible')
        $('.modal-data').css('visibility', 'visible')
    }

    //添加一行
    $('.addTable').click(function () {
        var tr_len = $("#table1 tr").length;
        var str = ""
        str += '<tr style="margin-top: 45px" class=jx' + tr_len + '>'
        str += '<td width="20px"><input type="checkbox" name="check" style="width: 15px"></td>'
        str += '<td><input type="text" readonly="readonly" class="fseq2" value=' + tr_len + ' style="width: 40px"><input type="hidden" name="fseq" class="fseq" value=' + tr_len + '></td>'
        str += '<td><input type="text" name="cfchepai" class="cfchepai"></td>'
        str += '<td><input type="text" name="cfchexing" class="cfchexing" onblur="cfchexing2($(this))"></td>'
        str+='<td><input type="text" name="cfcarnumber" class="cfcarnumber"></td>'
        str += '<td><select name="cfkemu"><option value="1">科目一</option><option selected="selected"  value="2">科目二</option><option value="3">科目三</option></select></td>'
        $.ajax({
            url: '<%=path%>/DrivingSys/selectCarTypeAll',
            type: "post",
            dataType: "json",
            success: function (json) {
                str += '<td><select name="cfcartype">'
                for (var i = 0; i < json.length; i++) {
                    if (json[i] == 'C1'){
                        str += '<option selected value="' + json[i] + '">' + json[i] + '</option>'

                    }else{
                        str += '<option value="' + json[i] + '">' + json[i] + '</option>'
                    }
                }
                str += '</select></td>'
                str += '<td><input type="text" name="drivingName" class="drivingName is_click_ne" onclick = "kq($(this))"><input type="hidden" name="cfxyjsid"></td>'
                str += '<td><input type="text" name="cfprice" class="cfprice" onblur="cfprice2($(this))"></td>'
                str += '<td><input type="text" name="cfamount" class="cfamount" onblur="cfamount2($(this))"></td>'
                str += '<td><input type="text" name="cfqty" class="cfqty" onblur="cfqty2($(this))"></td>'
                str += '<td><input type="text" name="cfdesc" class="cfdesc"></td></tr>'
                $("#table1").append(str)
                $("#table2").show()
            },
            error: function () {
                aletr("错误")
            }
        })

    })

    //可以输入小数点
    $(".cfprice,.cfamount").live('keyup', function (event) {
        var cfremark = $(this).prop("class");
        if (cfremark == 'cfremark') {

        } else {
            //最后一位是小数点的话，移除
            var $amountInput = $(this);
            //响应鼠标事件，允许左右方向键移动
            event = window.event || event;
            if (event.keyCode == 37 | event.keyCode == 39) {
                return;
            }
            var clazz = $(this).prop("class")
            //获取父类class名称
            var superclass = $(this).parent().parent().prop("class")
            //获取输入框的值
            var value = $('.' + clazz + '').val();
            //判断负数是否在第一位
            if (value.substring(0, 1) == '-') {

            }
            //判断负数不是在第一位，替换
            if (value.lastIndexOf('-') > 0) {
                $('.superclass .' + clazz + '').val("")
                // $amountInput.val($amountInput.val().replace('-','')
            }
            //先把非数字的都替换掉，除了数字和.
            $amountInput.val($amountInput.val().replace(/[^\-?\d.]/g, "").//只允许一个小数点
            replace(/^\./g, "").replace(/\.{2,}/g, ".").//只能输入小数点后两位
            replace(".", "$#$").replace(/\./g, "").replace("$#$", ".").replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3'));
        }
    });
    //当键盘按下之后立即校验，并替换当前操作框中的内容
    //只能输入正整数
    $(".cfqty,.cfchexing").live('keyup', function (event) {
        if ($(this).val() == '0') {

        } else {
            $(this).val($(this).val().replace(/\D|^0/g, ''));
        }
    });

    /* 关闭弹出框    */
    $('.btn').click(function () {
        $('#modal-overlay').css('visibility', 'hidden')
        $('.modal-data').css('visibility', 'hidden')
        $('input:checkbox').removeAttr('checked');
    })

    //根据条件查询驾校
    $(".findBtn").click(function () {
        var name = $(".name").val();
        $.ajax({
            url: '<%=path%>/DrivingSys/queryDrivingByName',
            type: "post",
            async: true,
            data: {'name': name},
            dataType: "json",
            success: function (json) {
                var str = ''
                for (var i = 0; i < json.length; i++) {
                    str += '<tr style="margin-top: 45px" class="jx">'
                    str += '<td><input type="checkbox" name="jx" value=' + json[i].fid + '></td>'
                    str += '<td>' + json[i].fnameL2 + '</td>'
                    if (json[i].fnumber == null) {
                        str += '<td></td>'
                    } else {
                        str += '<td>' + json[i].fnumber + '</td>'
                    }
                    if (json[i].fsimplename == null) {
                        str += '<td></td>'
                    } else {
                        str += '<td>' + json[i].fsimplename + '</td>'
                    }
                    if (json[i].fdescriptionL2 == null) {
                        str += '<td></td>'
                    } else {
                        str += '<td>' + json[i].fdescriptionL2 + '</td>'
                    }
                    if (json[i].fcreatetime == null) {
                        str += '<td></td>'
                    } else {
                        str += '<td>' + json[i].fcreatetime + '</td>'
                    }
                    if (json[i].createName == null) {
                        str += '<td></td>'
                    } else {
                        str += '<td>' + json[i].createName + '</td>'
                    }
                    if (json[i].flastupdatetime == null) {
                        str += '<td></td>'
                    } else {
                        str += '<td>' + json[i].flastupdatetime + '</td>'
                    }
                    if (json[i].updateName == null) {
                        str += '<td></td>'
                    } else {
                        str += '<td>' + json[i].updateName + '</td>'
                    }
                    if (json[i].companyName == null) {
                        str += '<td></td>'
                    } else {
                        str += '<td>' + json[i].companyName + '</td>'
                    }
                    str += '</tr>'
                }
                $(".jx").remove();
                $('.head2').append(str)
            },
            error: function () {
                alert('Error');
            }
        })

    })

    //单击选中
    $(".jx td").live('click', function () {
        $('input:checkbox[name=jx]:checked').each(function (i) {
            $(this).removeAttr("checked");
        });
        $(this).parent().find("input:checkbox").attr('checked', 'checked');
    })

    //选择数据
    $('.subtn').click(function () {
        var fseq = $(".stu").val();
        var fid;
        var name;
        $('input:checkbox[name=jx]:checked').each(function (i) {
            if (0 == i) {
                //把学生id增加到字表中
                fid = $(this).val();
                name = $(this).parent().next().text();
                $('.' + fseq + '').find(".drivingName").val(name)
                $('.' + fseq + '').find(".drivingName").next().val(fid)
            }

        });
        if (fid == null || fid == '') {
            alert("请选择一条数据")
            return false
        }
        $('#modal-overlay').css('visibility', 'hidden')
        $('.modal-data').css('visibility', 'hidden')
    });

    //双击确定
    $(document).on('dblclick', '.jx td', function () {
        var fseq = $(".stu").val();
        var fid;
        var name;
        //把学生id增加到字表中
        fid = $(this).parent().find("input:checkbox").val();
        name = $(this).parent().find("input:checkbox").parent().next().text();
        $('.' + fseq + '').find(".drivingName").val(name)
        $('.' + fseq + '').find(".drivingName").next().val(fid)
        $('#modal-overlay').css('visibility', 'hidden')
        $('.modal-data').css('visibility', 'hidden')
    })

    //金额计算
    function cfamount2(_this) {
        //避免最后一个字符串是.
        _this.val((_this.val().replace(/\.$/g, "")));
        if (_this.val() == '-') {
            _this.val("")
        }
        //判断输入错误
        if (isNaN(Number(_this.val()))) {
            _this.val("")
        }
        //计算金额
        jsje();
    }

    //计算反点
    function cfqty2(_this) {
        //避免最后一个字符串是.
        _this.val((_this.val().replace(/\.$/g, "")));
        if (_this.val() == '-') {
            _this.val("")
        }
        //判断输入错误
        if (isNaN(Number(_this.val()))) {
            _this.val("")
        }
        //计算金额
        jsrs();
    }

    //计算金额
    function jsje() {
        var cfamount = 0;
        $(".cfamount").each(function (i) {
            var s = $(this).val();
            if (s == null || s == '') {
                s = 0;
            }
            cfamount = (cfamount * 1) + (s * 1);
            cfamount = decimal(cfamount, 2);
        })
        $("#je").val(cfamount)
    }

    //计算人数
    function jsrs() {
        var num = 0;
        $(".cfqty").each(function (i) {
            var s = $(this).val();
            if (s == null || s == '') {
                s = 0;
            }
            num = (num * 1) + (s * 1);
            num = decimal(num, 2);
        })
        $("#rs").val(num)
    }

    //单价
    function cfprice2(_this) {
        //避免最后一个字符串是.
        _this.val((_this.val().replace(/\.$/g, "")));
        if (_this.val() == '-') {
            _this.val("")
        }
        //判断输入错误
        if (isNaN(Number(_this.val()))) {
            _this.val("")
        }
    }

    function cfchexing2(_this) {
        //判断输入错误
        if (isNaN(Number(_this.val()))) {
            _this.val("")
        }
    }

    //num是要处理的数字  v为要保留的小数位数
    function decimal(num, v) {
        var vv = Math.pow(10, v);
        return Math.round(num * vv) / vv;
    }

    window.onload = function () {
        //计算金额
        jsje();
        //计算人数
        jsrs();
    }

    //审核,反审核弹框
    $("#sh,#fsh").click(function () {
        var type = $(this).next().val();
        $("#type").val(type)
        if (type == 1) {
            $('#modal-overlay').css('visibility', 'visible')
            $('.modal-data9').css('visibility', 'visible')
            $('li input:radio:first').attr('checked', 'checked');
        }
        else if (type == 2) {
            $('#modal-overlay').css('visibility', 'visible')
            $('.modal-data10').css('visibility', 'visible')
        }
    })

    //审核,反审核
    $("#auditsubmit,#againstAuditsubmit").click(function () {
        //防止重复提交
        $(this).attr("disabled", "disabled")
        var state = $('li input[type="radio"]:checked ').val();//同意/不同意
        var fid = $("#fid").val();//fid
        var fnumber = $("input[name='fnumber']").val();//编码
        var type = $("#type").val();
        var message;
        if (type == '1') {
            message = $("#auditcomment").val();
        } else {
            message = $("#againstAuditcomment").val();
        }
        $.ajax({
            url: '<%=path%>/DrivingSys/auditOwnCarTrain',
            type: "post",
            data: {'fid': fid, 'type': type, 'fnumber': fnumber, 'message': message, 'state': state},
            dataType: "json",
            success: function (json) {
                var url = '/queryOwnCarTrain/look.action';
                if (type == '1') {
                    if (json == '1') {
                        showAlert('审核成功,并且此流程已结束', url)
                    } else if (json == '2') {
                        showAlert('审核成功', url)
                    } else {
                        showAlert('审核失败', url)
                    }
                } else {
                    if (json == '1') {
                        showAlert('反审核成功', url)
                    } else if (json == '2') {
                        showAlert('没有找到任务', url)
                    } else if (json == '0') {
                        showAlert('找不到流程节点', url)
                    }
                }
            },
            error: function () {
                $("#againstAuditsubmit,#auditsubmit").attr("disabled", false)//去除input元素的disabled属性
                alert('错误');
            }
        })
    })

    //提交
    $("#submit").click(function () {
        $.messager.confirm('提示', '是否提交,提交后不会改变修改后的值', function (r) {
            if (r) {
                var url = '/queryOwnCarTrain/look.action';
                var fid = $("#fid").val();
                var fnumber = $("input[name='fnumber']").val();
                var auditState = $("#auditState").val();
                $.ajax({
                    url: '<%=path%>/DrivingSys/submitOwnCarTrain',
                    type: "post",
                    data: {'fid': fid, 'fnumber': fnumber, 'auditState': auditState},
                    dataType: "json",
                    success: function (json) {
                        if (json == '1') {
                            showAlert('提交成功', url)
                        } else {
                            showAlert('提交失败', url)
                        }
                    },
                    error: function () {
                        alert('Error');
                    }
                })
            }
        })
    })

    //验证单据下是否有数据
    function verify() {
        var s = 0;
        $("input[name='fseq']").each(function () {
            if ($(this).val() == '' || $(this).val() == null) {

            } else {
                s = 1;
                return false;
            }

        })
        var ywrq = $("#ywrq").val();
        if (ywrq == null || ywrq == '') {
            alert("业务日期不能为空");
            return false;
        }

        if (s == 0) {
            alert("请至少添加一条数据");
            return false;
        }
        $("input[type='submit']").attr("disabled", "disabled");
    }

    function Arabia_to_Chinese(Num) {
        if (Num == "0") {
            return "零元整";
        }
        for (i = Num.length - 1; i >= 0; i--) {
            Num = Num.replace(",", "")//替换tomoney()中的“,”
            Num = Num.replace(" ", "")//替换tomoney()中的空格
        }
        Num = Num.replace("￥", "")//替换掉可能出现的￥字符
        if (isNaN(Num)) { //验证输入的字符是否为数字
            //alert("请检查小写金额是否正确");
            return;
        }
        //---字符处理完毕，开始转换，转换采用前后两部分分别转换---//
        part = String(Num).split(".");
        newchar = "";
        //小数点前进行转化
        for (i = part[0].length - 1; i >= 0; i--) {
            if (part[0].length > 10) {
                alert("位数过大，无法计算");
                return "";
            } //若数量超过拾亿单位，提示
            tmpnewchar = ""
            perchar = part[0].charAt(i);
            switch (perchar) {
                case "0":
                    tmpnewchar = "零" + tmpnewchar;
                    break;
                case "1":
                    tmpnewchar = "壹" + tmpnewchar;
                    break;
                case "2":
                    tmpnewchar = "贰" + tmpnewchar;
                    break;
                case "3":
                    tmpnewchar = "叁" + tmpnewchar;
                    break;
                case "4":
                    tmpnewchar = "肆" + tmpnewchar;
                    break;
                case "5":
                    tmpnewchar = "伍" + tmpnewchar;
                    break;
                case "6":
                    tmpnewchar = "陆" + tmpnewchar;
                    break;
                case "7":
                    tmpnewchar = "柒" + tmpnewchar;
                    break;
                case "8":
                    tmpnewchar = "捌" + tmpnewchar;
                    break;
                case "9":
                    tmpnewchar = "玖" + tmpnewchar;
                    break;
            }
            switch (part[0].length - i - 1) {
                case 0:
                    tmpnewchar = tmpnewchar + "元";
                    break;
                case 1:
                    if (perchar != 0) tmpnewchar = tmpnewchar + "拾";
                    break;
                case 2:
                    if (perchar != 0) tmpnewchar = tmpnewchar + "佰";
                    break;
                case 3:
                    if (perchar != 0) tmpnewchar = tmpnewchar + "仟";
                    break;
                case 4:
                    tmpnewchar = tmpnewchar + "万";
                    break;
                case 5:
                    if (perchar != 0) tmpnewchar = tmpnewchar + "拾";
                    break;
                case 6:
                    if (perchar != 0) tmpnewchar = tmpnewchar + "佰";
                    break;
                case 7:
                    if (perchar != 0) tmpnewchar = tmpnewchar + "仟";
                    break;
                case 8:
                    tmpnewchar = tmpnewchar + "亿";
                    break;
                case 9:
                    tmpnewchar = tmpnewchar + "拾";
                    break;
            }
            newchar = tmpnewchar + newchar;
        }
        //小数点之后进行转化
        if (Num.indexOf(".") != -1) {
            if (part[1].length > 2) {
                alert("小数点之后只能保留两位,系统将自动截段");
                part[1] = part[1].substr(0, 2)
            }
            for (i = 0; i < part[1].length; i++) {
                tmpnewchar = ""
                perchar = part[1].charAt(i)
                switch (perchar) {
                    case "0":
                        tmpnewchar = "零" + tmpnewchar;
                        break;
                    case "1":
                        tmpnewchar = "壹" + tmpnewchar;
                        break;
                    case "2":
                        tmpnewchar = "贰" + tmpnewchar;
                        break;
                    case "3":
                        tmpnewchar = "叁" + tmpnewchar;
                        break;
                    case "4":
                        tmpnewchar = "肆" + tmpnewchar;
                        break;
                    case "5":
                        tmpnewchar = "伍" + tmpnewchar;
                        break;
                    case "6":
                        tmpnewchar = "陆" + tmpnewchar;
                        break;
                    case "7":
                        tmpnewchar = "柒" + tmpnewchar;
                        break;
                    case "8":
                        tmpnewchar = "捌" + tmpnewchar;
                        break;
                    case "9":
                        tmpnewchar = "玖" + tmpnewchar;
                        break;
                }
                if (i == 0) tmpnewchar = tmpnewchar + "角";
                if (i == 1) tmpnewchar = tmpnewchar + "分";
                newchar = newchar + tmpnewchar;
            }
        }
        //替换所有无用汉字
        while (newchar.search("零零") != -1)
            newchar = newchar.replace("零零", "零");
        newchar = newchar.replace("零亿", "亿");
        newchar = newchar.replace("亿万", "亿");
        newchar = newchar.replace("零万", "万");
        newchar = newchar.replace("零元", "元");
        newchar = newchar.replace("零角", "");
        newchar = newchar.replace("零分", "");

        if (newchar.charAt(newchar.length - 1) == "元" || newchar.charAt(newchar.length - 1) == "角")
            newchar = newchar + "整"
        //  document.write(newchar);
        return newchar;

    }

    function print_func() {
        /*var aa = $('.trainChargeTable').find('tr:eq(0)').find('td:eq(2)').text();
    alert(aa);
    return;
    debugger;*/
        $('.content_id').css('display', 'block');

        $('#big_amount').text(Arabia_to_Chinese($('#big_amount').text()))
        /*包含規費*/
        $('.content_id').print({
            //是否读取页面的样式
            globalStyles: true,
            //添加与attrbute media=打印的链接。
            mediaPrint: false,
            //在隐藏的iframe中打印。
            iframe: false,
            //不打印 的内容（选择器）
            noPrintSelector: ".avoid-this",
            //Add this at top
            prepend: "Hello World!!!<br/>",
            //Add this on bottom
            append: "<br/>Buh Bye!",
            //Log to console when printing is done via a deffered callback
            deferred: $.Deferred().done(function () {
                console.log('Printing done', arguments);
            })
        });
        $('.content_id').css('display', 'none');
        //$.print("#print-table-id");
    }
</script>
</html>